#include "ROPlayerValidator.h"
ROPlayerEvent::ROPlayerEvent(QObject *parent):QObject(parent)
{

}

bool ROPlayerEvent::accepted() const
{
    return m_accepted;
}

void ROPlayerEvent::setAccepted(bool newAccepted)
{
    if (m_accepted == newAccepted)
        return;
    m_accepted = newAccepted;
    emit acceptedChanged();
}

QVariantMap ROPlayerEvent::loginParam() const
{
    return m_loginParam;
}

void ROPlayerEvent::setLoginParam(const QVariantMap &newLoginParam)
{
    if (m_loginParam == newLoginParam)
        return;
    m_loginParam = newLoginParam;
    emit loginParamChanged();
}

QString ROPlayerEvent::rejectMessage() const
{
    return m_rejectMessage;
}

void ROPlayerEvent::setRejectMessage(const QString &newRejectMessage)
{
    if (m_rejectMessage == newRejectMessage)
        return;
    m_rejectMessage = newRejectMessage;
    emit rejectMessageChanged();
}

ROPlayerValidator::ROPlayerValidator(QObject *parent):QObject(parent),m_event(new ROPlayerEvent(this))
{

}

ROPlayerEvent* ROPlayerValidator::validate(const QVariantMap& loginParam)
{
    m_event->setLoginParam(loginParam);
    m_event->setAccepted(true);

    emit playerJoin(m_event);

    return m_event;
}

ROPlayerValidator::Policy ROPlayerValidator::policy() const
{
    return m_policy;
}

void ROPlayerValidator::setPolicy(const Policy &newPolicy)
{
    if (m_policy == newPolicy)
        return;
    m_policy = newPolicy;
    emit policyChanged();
}
